import sql_query from '@dfeidao/atom-nodejs/db/sql-query';
import log from '@dfeidao/atom-nodejs/logger/log';
import { IncomingHttpHeaders } from 'http';
import { spaceid, systemid } from '../../atom/config';

interface Message {
	msgid: string;
	productid: string;
}

interface Msg {
	param_name: string;
	param_datatype: string;
	param_value: string;
	msgid: string;
}



export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders) {
	log('Service begin path:common/zj-000001/s005,action_id:' + action_id);


	const sql = `select mpp.param_name,mpp.param_datatype,mpp.param_value from msg_page_params mpp where mpp.msgid='${message.msgid}' and mpp.productid='${message.productid}'`;

	const res = await sql_query<Msg>(action_id, session_id, systemid, spaceid, sql, 'mysql');

	log('Service end path:common/zj-000001/s005,action_id:' + action_id);
	return { res };
}
